package com.weimob.mcloud.wechatwork.customer.es.dto;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Data
@Document(indexName = "saas-wechatwork-content-customer-touch-record-statistic-bi", shards = 12, replicas = 1, refreshInterval = "10ms")
public class CustomerLoseFinalTouchBiDocument {

    @Id
    private String id;

    /**
     * 私域id
     */
    @Field(type = FieldType.Keyword)
    private String privateSphereId;

    @Field(type = FieldType.Keyword)
    private Long ecvid;

    /**
     * 外部联系人主键id
     */
    @Field(type = FieldType.Keyword)
    private String customerId;

    /**
     * 员工主键id
     */
    @Field(type = FieldType.Keyword)
    private String orgUserId;

    /**
     * 触发任务类型:1-个人sop ，2-企业群发 ，3-话术库 ，4-客户裂变 ， 5-标签建群 ， 6-侧边栏发商品 ， 7-侧边栏发优惠券
     */
    @Field(type = FieldType.Keyword)
    private Integer touchType;

    /**
     * 任务id
     */
    @Field(type = FieldType.Keyword)
    private String taskId;


    /**
     * 客户触达时间
     */
    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "epoch_millis")
    private Date touchTime;

    /**
     * 记录创建时间
     */

    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "epoch_millis")
    private Date createTime;


    public CustomerLoseFinalTouchBiEO toEO() {
        CustomerLoseFinalTouchBiEO customerLoseFinalTouchBiEO = new CustomerLoseFinalTouchBiEO();
        customerLoseFinalTouchBiEO.setId(this.getId());
        customerLoseFinalTouchBiEO.setCustomerId(this.getCustomerId());
        customerLoseFinalTouchBiEO.setOrgUserId(this.getOrgUserId());
        customerLoseFinalTouchBiEO.setPrivateSphereId(this.getPrivateSphereId());
        customerLoseFinalTouchBiEO.setCreateTime(this.getCreateTime());
        customerLoseFinalTouchBiEO.setTaskId(this.getTaskId());
        customerLoseFinalTouchBiEO.setTouchTime(this.getTouchTime());
        customerLoseFinalTouchBiEO.setTouchType(this.getTouchType());
        customerLoseFinalTouchBiEO.setEcvid(this.getEcvid());
        return customerLoseFinalTouchBiEO;
    }

}
